﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace NoORM.Core.DbDialect
{
    public interface IDbDialect
    {
        /// <summary>
        /// 构建sql语句时创建参数
        /// </summary>
        /// <param name="parameterName">参数名称</param>
        /// <returns></returns>
        string BuildParameterName(string parameterName);

        /// <summary>
        /// 创建DbParameter实例时创建参数名称
        /// </summary>
        /// <param name="parameterName">参数名称</param>
        /// <returns></returns>
        string CreateParameterName(string parameterName);

        /// <summary>
        /// 包裹表名或字段名
        /// </summary>
        /// <param name="fieldOrTableName"></param>
        /// <returns></returns>
        string WrapFieldName(string tableOrFieldName);

        /// <summary>
        /// DELETE关键字后面要使用的关键字，通常是FROM
        /// </summary>
        /// <returns></returns>
        string DeleteFrom();

        /// <summary>
        /// 获取分页的查询语句
        /// </summary>
        /// <param name="sql">未分页的查询语句</param>
        /// <param name="orderby">排序字段</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="pageIndex">页码</param>
        /// <returns></returns>
        string GetPageSql(string sql, string orderby, int pageSize, int pageIndex);

    }
}
